using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using bookMaster.AssetSystem.Data;

namespace bookMaster.AssetSystem.Shell.Controles
{
    public partial class ctlFiltroTexto : UserControl, IFiltros
    {
        public ctlFiltroTexto()
        {
            InitializeComponent();
            cmbOperador.SelectedIndex = 0;
        }

        public StringBuilderExpression Operador
        {
            get
            {

                if (cmbOperador.Text.ToLower() == "es igual a")
                    return StringBuilderExpression.AppendEquals;

                if (cmbOperador.Text.ToLower() == "es distinto de")
                    return StringBuilderExpression.AppendNotEquals;

                if (cmbOperador.Text.ToLower() == "comienza con")
                    return StringBuilderExpression.AppendStartsWith;

                if (cmbOperador.Text.ToLower() == "termina con")
                    return StringBuilderExpression.AppendEndsWith;

                if (cmbOperador.Text.ToLower() == "contiene")
                    return StringBuilderExpression.AppendContains;

                return StringBuilderExpression.Append;

            }
        }

        public string Valor
        {
            get
            {
                return txtABuscar.Text;
            }
        }

        public bool SetVisible
        {
            set
            {
                this.Visible = value;
            }
        }
    
    }
}
